
public class Sentence
{
   public Sentence(String input)
   {
      myString = input;
   }
   public int countWords()
   {
      String words[] = myString.split(" ");
      return words.length;
   }
   public boolean equals(Sentence other)
   {
      return myString.equals(other.getSentence());
   }
   public String reverse()
   {
      String reversed = "";
      for(int index =myString.length()-1;index>=0;index--)
      {
         reversed += myString.charAt(index);
      }
      return reversed;
   }
   public String getSentence()
   {
      return myString;
   }
   public String reverseWords()
   {
      String reversed = "";
      String words[] = myString.split(" ");
      for(int index = words.length-1;index >= 0;index--)
      {
         reversed += words[index] + " ";
      }
      
      return reversed.trim();
      
   }
   private String myString;
}
